package lormi.meipin.controller.api;

import lormi.meipin.annotation.NotValidUser;
import lormi.meipin.common.Result;
import lormi.meipin.controller.BaseController;
import lormi.meipin.exception.LMException;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;


/**
 * 职位信息
 * */
@RestController
@RequestMapping(value="v2/positionclass/",method=RequestMethod.POST,produces = "application/json; charset=utf-8")
public class PositionClassController extends BaseController{

	/**
	 * 获取一级职位列表
	 * */
	@RequestMapping("super")
	@NotValidUser
	public String select() throws LMException{
		return Result.success(positionClassService.getOnePositionClass());
	}
	/**
	 * 获取二级职位列表
	 * @Param parentid 父级类型ID
	 * */
	@RequestMapping("sub")
	@NotValidUser
	@Valid
	public String selectByParentid(@NotNull(message="100033") @RequestParam(value="parentid",required=false) Integer parentid) throws LMException{

		return Result.success(positionClassService.getTwoPositionClass(parentid));
	}
	
}
